const routerConfig = [
    { name: "查询统计", path: "./审核人员费用/查询统计.html" },
    { name: "审核人员费用结算", path: "./审核人员费用/审核人员费用结算.html" },
    { name: "审核人员费用确认", path: "./审核人员费用/审核人员费用确认.html" },
    { name: "审核人员管理", path: "./审核人员库/审核人员管理.html" },
    { name: "审核人员信息查询", path: "./审核人员库/审核人员信息查询.html" },
    { name: "审核人员资质管理", path: "./审核人员库/审核人员资质管理.html" },
];
function load() {
    document.querySelectorAll(".menu-wrapper .el-submenu__title").forEach((item) => {
        item.addEventListener('click', function(event) {
            var menuItemEL = this.parentElement.querySelector(".el-menu.el-menu--inline");
            if (menuItemEL.style.display === 'none') {
                menuItemEL.style.display = 'block';
            } else {
                menuItemEL.style.display = 'none';
            }
        });
    })
    document.querySelectorAll(".menu-wrapper .el-menu .el-menu-item").forEach((item) => {
        item.addEventListener('click', function(event) {
           const url = routerConfig.find(item => item.name === event.target.innerText)?.path;
           if(!url) return;
           const parentEle =  document.querySelector(".avue-view .basic-container .el-card__body");
           const myFrameDom = parentEle.querySelector("#myFrameId");
           const maskDom = parentEle.querySelector(".mask");
           const html = '<div class="mask" style="position: absolute;top: 40%;left: 50%;z-index: 1000;width: 100px;display: flex;flex-direction: column;align-items: center;margin-left: -50px"><i class="el-icon-loading"></i><p>加载中...</p></i></div>'
           parentEle.removeChild(myFrameDom);
           maskDom && (parentEle.removeChild(maskDom));
           myFrameDom.src = url;
           parentEle.insertAdjacentHTML('beforeend', html);
           parentEle.appendChild(myFrameDom);
           myFrameDom.onload = function () {
            parentEle.querySelector(".mask").style.display = 'none';
           }
        });
    })
}

load()